package pool;

import mission.Mission;

import org.apache.commons.pool.PoolableObjectFactory;

public class MissionPoolFactory implements PoolableObjectFactory<Mission> {
	
	@Override
	public void activateObject(Mission value) throws Exception 
	{
		value.used();
	}

	@Override
	public void destroyObject(Mission value) throws Exception 
	{
		value.clean();
		value = null;
	}

	@Override
	public Mission makeObject() throws Exception 
	{
		Mission value = new Mission();
		value.used();
		return value;
	}

	@Override
	public void passivateObject(Mission value) throws Exception 
	{
		value.released();
	}

	@Override
	public boolean validateObject(Mission value) 
	{
		return value.check();
	}

}
